package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyProjectGetPropertyInfoBrowseStatusDTO;
import com.itlong.cloud.POJO.DTO.property.PropertyProjectGetPropertyInfoDTO;
import com.itlong.cloud.POJO.VO.property.PropertyProjectPropertyInfoBrowseStatusVO;
import com.itlong.cloud.POJO.VO.property.PropertyProjectPropertyInfoVO;
import com.itlong.cloud.project.property.IPropertyPropertyInfoServiceClient;
import com.itlong.cloud.property.service.IPropertyPropertyInfoService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <desc>
 *    物业投诉、物业报修、物业通知与便民信息 服务暴露接口实现类.
 * </desc>
 *
 * @createDate 2017-10-16
 */
@RestController
public class PropertyPropertyInfoServiceResource implements IPropertyPropertyInfoServiceClient {

    @Autowired
    IPropertyPropertyInfoService iPropertyPropertyInfoService;

    /**
     * <desc>
     *      单条查询 物业信息
     * <desc/>
     *
     * @param propertyInfoId 查询参数
     * @return
     * @author ZiXuan
     * @createDate 2017-12-01
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/getOnePropertyInfo",method = {RequestMethod.POST})
    public PropertyProjectPropertyInfoVO getOnePropertyInfo(@RequestParam("propertyInfoId") String propertyInfoId) throws Exception{
        PropertyProjectPropertyInfoVO propertyProjectPropertyInfoVO = iPropertyPropertyInfoService.getOnePropertyInfo(propertyInfoId);
        return propertyProjectPropertyInfoVO;
    }

    /**
     * <desc>
     *      分页获取 物业信息
     * <desc/>
     *
     * @param pageDTO 分页获取 物业信息条件对象
     * @return
     * @author ZiXuan
     * @createDate 2017-10-16
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/getPage",method = {RequestMethod.POST})
    public Page<PropertyProjectPropertyInfoVO> getPage(@RequestBody PropertyProjectGetPropertyInfoDTO pageDTO) throws Exception{
        Page<PropertyProjectPropertyInfoVO> page = iPropertyPropertyInfoService.getPage(pageDTO);
        return  page;
    }


    /**
     * <desc>
     *      保存 物业信息。
     * <desc/>
     *
     * @param  propertyDTO 请求参数
     * @return
     * @author ZiXuan
     * @createDate 2017-10-26
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/savePropertyInfo", method = {RequestMethod.POST})
    public Integer savePropertyInfo(@RequestBody PropertyProjectGetPropertyInfoDTO propertyDTO) throws Exception{
        return iPropertyPropertyInfoService.savePropertyInfo(propertyDTO);
    }

    /**
     * <desc>
     *      修改 物业信息。
     * <desc/>
     *
     * @param  propertyDTO 请求参数
     * @return
     * @author ZiXuan
     * @createDate 2017-10-26
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/updatePropertyInfo", method = {RequestMethod.POST})
    public Integer updatePropertyInfo(@RequestBody PropertyProjectGetPropertyInfoDTO propertyDTO) throws Exception{
        return iPropertyPropertyInfoService.updatePropertyInfo(propertyDTO);
    }

    /**
     * <desc>
     *      删除物业信息。
     * <desc/>
     *
     * @param propertyInfoIds 物业信息ID列表
     * @return 返回影响行数
     * @author ZiXuan
     * @createDate 2017-11-02
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/deletePropertyInfo", method = {RequestMethod.POST})
    public Integer deletePropertyInfo(@RequestParam("propertyInfoIds") String propertyInfoIds) throws Exception{
        return iPropertyPropertyInfoService.deletePropertyInfo(propertyInfoIds);
    }

    /**
     * <desc>
     *      分页获取 物业信息浏览状态
     * <desc/>
     *
     * @param pageDTO 分页获取 物业信息浏览状态条件对象
     * @return
     * @author ZiXuan
     * @createDate 2017-12-21
     */
    @RequestMapping(path = "/property/propertyInfo/getPropertyInfoBrowseStatusPage",method = {RequestMethod.POST})
    public Page<PropertyProjectPropertyInfoBrowseStatusVO> getPropertyInfoBrowseStatusPage(@RequestBody PropertyProjectGetPropertyInfoBrowseStatusDTO pageDTO) throws Exception{

        Page<PropertyProjectPropertyInfoBrowseStatusVO> page = iPropertyPropertyInfoService.getPropertyInfoBrowseStatusPage(pageDTO);
        return  page;
    }

    /**
     * <desc>
     *      保存 物业信息浏览状态
     * <desc/>
     *
     * @param  propertyDTO 请求参数
     * @return
     * @author ZiXuan
     * @createDate 2017-12-21
     */
    @RequestMapping(path = "/property/propertyInfo/savePropertyInfoBrowseStatus", method = {RequestMethod.POST})
    public Integer savePropertyInfoBrowseStatus(@RequestBody PropertyProjectGetPropertyInfoBrowseStatusDTO propertyDTO) throws Exception{
        return iPropertyPropertyInfoService.savePropertyInfoBrowseStatus(propertyDTO);
    }

    /**
     * <desc>
     *      获取投诉记录列表
     * </desc>
     *
     * @param projectId 项目编号
     * @param pageIndex 当前页数(每页15条)
     * @param userId 用户id
     * @return 投诉记录列表
     * @author wangzhi
     * @createDate 2019/06/17
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/getComplaintList", method = {RequestMethod.POST})
    public Map<String, Object> getComplaintList(@RequestParam("projectId") String projectId, @RequestParam("pageIndex") String pageIndex, @RequestParam("userId") String userId) throws Exception {
        return iPropertyPropertyInfoService.getComplaintList(projectId, pageIndex, userId);
    }

    /**
     * <desc>
     *      获取投诉详情
     * </desc>
     *
     * @param msgId 投诉记录ID
     * @return 投诉详情
     * @author wangzhi
     * @createDate 2019/06/17
     */
    @Override
    @RequestMapping(path = "/property/propertyInfo/getComplaintDetail", method = {RequestMethod.POST})
    public Map<String, Object> getComplaintDetail(@RequestParam("msgId") String msgId) throws Exception {
        return iPropertyPropertyInfoService.getComplaintDetail(msgId);
    }
}
